package com.ay.demo.akka.hello;

import java.util.concurrent.TimeUnit;

import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.actor.Props;

public class HelloWorldTest {

	public static void main(String[] args) {
		testFunction();
		testPresure();
		System.exit(0);
	}

	private static void testPresure() {
		try {
			TimeUnit.SECONDS.sleep(30);
		} catch (Exception e){}
		ActorSystem actorSystem = ActorSystem.create();
		ActorRef ref = actorSystem.actorOf(Props.create(HelloWorld.class));
		for (int i = 0; i < 5000; i++) {
			ref.tell("Hello-" + i, ActorRef.noSender());
		}
	}

	private static void testFunction() {
		ActorSystem actorSystem = ActorSystem.create();
		ActorRef ref = actorSystem.actorOf(Props.create(HelloWorld.class));
		System.out.println(ref);
		ref.tell("Hello", ActorRef.noSender());
	}
}
